package com.vanke.devops.api.controller.influxdb;

import com.vanke.core.bean.ApiBaseResponse;
import com.vanke.devops.api.base.BaseController;
import com.vanke.devops.domain.manager.influxdb.InfluxDbManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 陈景阳
 * @since 2018/6/9
 */
@RestController
@RequestMapping("/influx-db")
public class InfluxDbController extends BaseController{

    @Autowired
    private InfluxDbManager influxDbManager;

    @GetMapping("/version")
    public ApiBaseResponse version(){
        return setResponse(influxDbManager.version());
    }

    @GetMapping("/node/{hostname}")
    public ApiBaseResponse node(@PathVariable("hostname") String hostname){
        return setResponse(influxDbManager.queryNode(hostname));
    }
}
